<template >
  <div class="index-reflect" :style="{ 'background': bg, '--top': top }" @click="turn">
    <div class="txt-box">
      <div class="title" :style="{ 'color': title_color }">{{ title }}</div>
      <div class="desc" :style="{ 'color': desc_color }">{{ desc }}</div>
    </div>
    <div class="img-box">
      <div class="left-icon">
        <img src="/round-pink1.png" alt="图片加载失败">
      </div>
      <div class="show-img">
        <img :src="img" alt="图片加载失败">
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      required: true
    },
    title_color: {
      type: String,
      default: "#fff"
    },
    desc: {
      type: String,
      required: true
    },
    desc_color: {
      type: String,
      default: "#fff"
    },
    img: {
      type: String,
      required: true
    },
    bg: {
      type: String,
      default: ""
    },
    top: {
      type: String,
      default: "15"
    },
    bind: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {

    }
  },
  methods: {
    turn () {
      if (this.bind) {
        this.$emit("handle")
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.index-reflect {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: rem(345);
  height: rem(76);
  box-shadow: rem(2) rem(4) rem(8) rgb(190 178 213 / 50%);
  border-radius: rem(8);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  margin-top: rem(var(--top));

  .txt-box {
    padding-left: rem(25);

    .title {
      font-size: rem(18);
      margin-bottom: rem(2);
      font-weight: bold;
    }

    .desc {
      max-width: 95%;
      font-size: rem(14);
    }
  }

  .img-box {
    display: flex;
    align-items: center;
    width: rem(103);

    .left-icon {
      width: rem(28);
      height: rem(28);
    }

    .show-img {
      width: rem(76);
      height: rem(76);

      img {
        @include img;
      }
    }
  }
}
</style>
